package com.wjj.sixinone.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Data
public class MinioConfig {

    @Value("${wjj.storage.minio.endpoint}")
    private String minioEndpoint;

    @Value("${wjj.storage.minio.access-key}")
    private String minioAccessKey;

    @Value("${wjj.storage.minio.secret-key}")
    private String minioSecretKey;
    @Value("${wjj.storage.minio.bucketName}")
    private String bucketName;
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(minioEndpoint)
                .credentials(minioAccessKey, minioSecretKey)
                .build();
    }
}
